package com.wtone.platform.gat.images.gat.message;

import com.wtone.platform.gat.images.gat.model.*;
import com.wtone.platform.gat.images.gat.service.SubscribenotificPublicService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: aiLin
 * @Date: 2020/10/12 18:19
 * @desc: 远程调用视图库订阅通知接口，发布订阅通知至父视图库
 */
@Slf4j
@Component
public class FeignSubImageInfoCore {

    @Autowired
    private SubscribenotificPublicService subscribeNotifications;

    public void getSubImageInfo(List<SubImageInfo> subImageInfo, FaceListObject faceListObject){
        if(subImageInfo==null || subImageInfo.size()<=0){
            return;
        }
        SubscribeNotificationListObject subscribeNotific = new SubscribeNotificationListObject();
        SubscribeNotificationObject subscribeNotificationObject = new SubscribeNotificationObject();
        List<SubscribeNotification> subscribeNotificationLists = new ArrayList<SubscribeNotification>();
        SubscribeNotification sub = new SubscribeNotification();
        //人脸对象
        sub.setFaceObjectList(faceListObject);

        subscribeNotificationLists.add(sub);
        subscribeNotificationObject.setSubscribeNotifications(subscribeNotificationLists);
        subscribeNotific.setSubscribeNotificationObject(subscribeNotificationObject);
        subscribeNotifications.subscribeNotifications(subscribeNotific);
    }
}
